package com.thor.palmmall.rest.order.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.commons.entity.UCN;
import com.thor.palmmall.rest.order.AProductProm;
import com.thor.palmmall.rest.order.AProductProm2;
import com.thor.palmmall.spi.order.SProductProm;
import com.thor.palmmall.spi.order.SProductProm2;

public class AProductProm2Converter implements Converter<SProductProm2, AProductProm2> {
	private static AProductProm2Converter instance;
	public static AProductProm2Converter getInstance() {
		if (instance == null)
			instance = new AProductProm2Converter();
		return instance;
	}

	private AProductProm2Converter() {
	}

	@Override
	public AProductProm2 convert(SProductProm2 source) {
		if (source == null) {
			return null;
		}
		AProductProm2 target = new AProductProm2();
		target.setPromBillUuid(source.getPromBillUuid());
		target.setActivityName(source.getActivityName());
		target.setContract(UCN.newInstance(source.getContract()));
		
		return target;
	}

}
